package com.itheima.job;

import com.itheima.service.OrderService;
import com.itheima.service.OrderSettingService;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class ClearJob {
    @Autowired
    OrderSettingService  orderSettingService;
    public void run(){
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        Date date = calendar.getTime();

       SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD");
        orderSettingService.delForDate(sdf);



    }

}
